package com.lkm.app_ui.help;

import com.lkm.app_ui.AppConst;
import com.lkm.app_ui.m.fun.FunModule;
import com.lkm.javatool.lang.RunnablePR;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;



public  class LockKeyManager {

    
    final static List<RunnablePR<Void,Boolean>> isLockQueue = new ArrayList<>();

    public synchronized static void addPage(RunnablePR<Void, Boolean> page){
        isLockQueue.add(page);
    }
    public synchronized static void removePage(RunnablePR<Void, Boolean> page){
        isLockQueue.remove(page);
    }


    

    public synchronized static void curPageLockChange(){

        boolean isLock =  false ;
        try {
            isLock = isLockQueue.get(isLockQueue.size()-1).run(null);
        }catch (Exception e){
            
            isLock =  false;
        }

        try{
            FunModule steelyardServerModule = AppConst.getModuleManager().loadModule(FunModule.class);
            steelyardServerModule.setLockKeySwitch(isLock);
        }catch (Exception e){

        }
    }

}
